using System.IO;

namespace Common
{
	public class ConfigHide
	{
		private static string iniFile = Path.GetTempPath() + "ConfigHide.ini";

		private static ConfigHide configHide = null;

		public double OverTemperature = 7.0;

		public double ArriveThreshold = 2.0;

		public static ConfigHide GetInstance()
		{
			if (configHide == null)
			{
				configHide = new ConfigHide();
				configHide.Load();
			}
			return configHide;
		}

		private void Load()
		{
			OverTemperature = (double)AccessIniFile.ReadIntValue(iniFile, "Setting", "OverTemperature", (int)(OverTemperature * 10.0)) / 10.0;
			ArriveThreshold = (double)AccessIniFile.ReadIntValue(iniFile, "Setting", "ArriveThreshold", (int)(ArriveThreshold * 100.0)) / 100.0;
		}

		public void SaveFast(double overTemperature, double threshold)
		{
			OverTemperature = overTemperature;
			ArriveThreshold = threshold;
			AccessIniFile.WriteValue(iniFile, "Setting", "OverTemperature", (OverTemperature * 10.0).ToString());
			AccessIniFile.WriteValue(iniFile, "Setting", "ArriveThreshold", (ArriveThreshold * 100.0).ToString());
		}
	}
}
